<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="s" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="sf" %>
<%@ page session="false" %>

<script>
if(window.opener) {
	window.opener.location.reload(false);
	window.close();
}
</script>

<h3>Connect to Facebook</h3>

<form action="<c:url value="/connect/facebook" />" method="POST" class="connectForm">
	<input type="hidden" name="scope" value="publish_stream,user_photos,offline_access" />
	<div class="formInfo">
		<p>You aren't connected to Facebook yet. Click the button to connect Spring Social Showcase with your Facebook account.</p>
	</div>
	<p><button class="connectButton" type="submit"><img src="<c:url value="/resources/social/facebook/connect_light_medium_short.gif" />"/></button></p>
	<label for="postToWall"><input id="postToWall" type="checkbox" name="postToWall" /> Tell your friends about Spring Social Showcase on your Facebook wall</label>
</form>

<script>
$(document).ready(function() {
	$(".connectButton").click(function(event){
		event.preventDefault();
		window.open("", "connectWindow", "width=600,height=400");
		var cTP = $(event.currentTarget).parent().parent();		
		cTP[0].setAttribute("target", "connectWindow");
		cTP[0].submit();
	});
});
</script>